# 字典（dictionary）为映射类型

# 方式1
dict1 = {1: 110, 3.14: 3.145927, 'hello': 'Hello,Python'}
print(type(dict1))  # <class 'dict'>
print(dict1[1])  # 110
print(dict1['hello'])  # Hello,Python

# 方式2
dict2 = dict(([1, 110], [2, 120], (3, 'hello')))
print(dict2)  # {1: 110, 2: 120, 3: 'hello'}

# 方式3
dict3 = dict(hello='Hello,Python', h='H')
print(dict3)
dict3['hello'] = 'Hello,World'  # {'hello': 'Hello,Python'}
print(dict3['hello'])  # Hello,World
# 向字典中加值
dict3['dict'] = 'dictionary'
print(dict3)  # {'hello': 'Hello,World', 'h': 'H', 'dict': 'dictionary'}
